<template>
  <div class="content">
    <div class="crumb"></div>
    <div class="tabs"></div>
    <div class="echarts">
      <div class="cont" id="con"></div>
    </div>
    <div class="tables">
      <table id="tab" align="center" width="90%">
        <thead style="background: #1a202c; color: #fff">
          <tr>
            <th>时间</th>
            <th>行业</th>
            <th>网络零售额(万元)</th>
            <th>同比(%)</th>
            <th>占比(%)</th>
          </tr>
        </thead>
        <tbody style="background: #1a202c; color: #fff">
          <tr v-for="item in table" :key="item.id">
            <td>{{ item.time }}</td>
            <td>{{ item.hang }}</td>
            <td>{{ item.sale }}</td>
            <td>{{ item.tb }}</td>
            <td>{{ item.zz }}</td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</template>

<script>
import * as echarts from "echarts";
export default {
  name: "BigdataindustryWebNoPhysicalanalysis",

  data() {
    return {
      table: [
        {
          time: "2022-1",
          hang: "娱乐",
          sale: "445",
          tb: "44%",
          zz: "22%",
        },
        {
          time: "2022-2",
          hang: "餐饮",
          sale: "445",
          tb: "44%",
          zz: "22%",
        },
        {
          time: "2022-3",
          hang: "住宿",
          sale: "445",
          tb: "44%",
          zz: "22%",
        },
        {
          time: "2022-4",
          hang: "游玩",
          sale: "445",
          tb: "44%",
          zz: "22%",
        },
      ],
    };
  },

  mounted() {
    this.drawechart();
  },

  methods: {
    drawechart() {
      var chartDom = document.getElementById("con");
      var myChart = echarts.init(chartDom);
      var option = {
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        legend: {
          orient: "vertical",
          x: "center",
          y: "top",
          backgroundColor: "transparent",
        },
        xAxis: {
          type: "category",
          data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
          axisTick: {
            //x轴刻度线
            show: false,
          },
        },
        yAxis: {
          type: "value",
          name: "单位:万元",
          nameLocation: "end",
          nameGap: 35,
        },
        series: [
          {
            name: "网络零售额",
            itemStyle: {
              barBorderRadius: [2, 2, 2, 2], //柱体圆角
              color: new echarts.graphic.LinearGradient(
                //右下左上 四个方位。也就是从右边开始顺时针方向
                /*第五个参数则是一个数组，用于配置颜色的渐变过程。
                          每项为一个对象，包含offset和color两个参数
                        */
                0,
                1,
                1,
                0,
                [
                  {
                    offset: 0,
                    color: "#3F95CE ",
                  },
                  {
                    offset: 1,
                    color: "#1DE7E7 ",
                  },
                ]
              ),
            },
            data: [120, 200, 150, 80, 70, 110, 130],
            type: "bar",
          },
        ],
      };

      option && myChart.setOption(option);
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  height: 100%;
  background: #1a202c;
  .echarts {
    .cont {
      width: 700px;
      height: 600px;
      margin: auto;
    }
  }
}
tr {
  text-align: center;
}
tr:nth-child(even) {
  background: #122843;
}
tr:nth-child(odd) {
  background: #181e30;
  // background-image: linear-gradient(#e66465, #9198e5);
}
</style>